
aiviki.effects.fade = aiviki.Class.create("aiviki.effects.fade")
aiviki.effects.fade.prototype = 
	{
	init:function(o,oo,ooo,oooo)
		{

		this.extend(new aiviki.anim.thread());
		if(o!=null)
			{
			this.obj=o;
			if(oo!=undefined)
				this.defaultOpacity=oo;
			if(ooo!=undefined)
				this.configOpacity=ooo;

			this.flagOpacity=this.defaultOpacity;

			if(oooo!=undefined)
				this.stepOpaceicty=oooo;


			}
		this.setDelay(50);
		},
		objId:"",
		obj:null,
		defaultOpacity:0,
		configOpacity:0,
		flagOpacity:0,
		stepOpaceicty:10,
		endFun:function(){},
		setEndFunction:function(a)
			{
			this.endFun=a;
			},
		destroy:function()
			{
				this.endFun();
			},
		run:function()
			{
			if(isIE)
				{
				this.obj.style.filter = 'alpha(opacity=' + this.flagOpacity + ')';
				if (!this.obj.currentStyle || !this.obj.currentStyle.hasLayout)
					this.obj.style.zoom = 1;
				}else{
				this.obj.style.opacity = (this.flagOpacity / 100);
				this.obj.style.MozOpacity = (this.flagOpacity / 100);
				this.obj.style.KhtmlOpacity = (this.flagOpacity / 100);
				}
			if(this.flagOpacity<this.configOpacity)
				{
				this.flagOpacity+=this.stepOpaceicty;
				if(this.flagOpacity>this.configOpacity)
					{
					this.destroy();
					return false;
					}

				}else{

				this.flagOpacity-=this.stepOpaceicty;
				if(this.flagOpacity<this.configOpacity)
					{
						this.destroy();
					return false;
					}
				}
			return true;
			}
	}
